//
//  SelfCenterController.m
//  iphone-yuzhuo-bbgmerchant
//
//  Created by yuzhuo on 16/8/22.
//  Copyright © 2016年 bianbiangou. All rights reserved.
//

#import "RegisterController.h"
#import "AFNetworking.h"
#import "MTAShowPopDialog.h"
#import "CommenLoginModel.h"
#import "GetMerchantInfoModel.h"
#import "UIColor+Util.h"
#import "Constant.h"

@interface RegisterController ()<UITextFieldDelegate>
{
    UITextField *_textFieldAccount;
    
}
/** 弹框视图 */
@property (nonatomic, strong) MTAShowPopDialog *showPopDialog;

@end

@implementation RegisterController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"注册";
    [self initViews];
}

#pragma  mark - UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    //当用户按下ruturn，把焦点从textField移开那么键盘就会消失了
    [textField resignFirstResponder];
    return YES;
}


-(void)initViews{
    CGFloat imgMarginLeft = 10;
    _textFieldAccount = [[UITextField alloc]initWithFrame:CGRectMake(30, imgMarginLeft*1.8+20, kScreenW-60, 50)];
    _textFieldAccount.delegate = self;
    _textFieldAccount.clearButtonMode=UITextFieldViewModeWhileEditing;
    _textFieldAccount.layer.borderColor = [UIColor colorWithHexString:@"#D55B65"].CGColor;
    _textFieldAccount.placeholder = @"手机号";
    _textFieldAccount.layer.borderWidth= 1.0f;
    _textFieldAccount.textColor = [UIColor colorWithHexString:@"#888888"];
    [_textFieldAccount.layer setMasksToBounds:YES];
    [self setTextFieldLeftPadding:_textFieldAccount forWidth:10];

    //登录账号按钮
    UIButton *loginButton = [[UIButton alloc] initWithFrame:CGRectMake(30, imgMarginLeft*1.8+130, kScreenW-60, 50)];
    loginButton.backgroundColor = [UIColor colorWithHexString:@"#D55B65"];
    [loginButton.layer setMasksToBounds:YES];
    [loginButton.layer setCornerRadius:5.0]; //设置矩形四个圆角半径
    [loginButton.layer setBorderWidth:1.0]; //边框宽度
    [loginButton.layer setBorderColor:[UIColor colorWithHexString:@"#D55B65"].CGColor];//边框颜色
    [loginButton setTitle:@"下一步" forState:UIControlStateNormal];//button title
    [loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];//title color
    [loginButton addTarget:self action:@selector(loginClickAction:) forControlEvents:UIControlEventTouchUpInside];
    //    [self.view addSubview:logoImage];
    [self.view addSubview:_textFieldAccount];
    [self.view addSubview:loginButton];
    
}

-(void)setTextFieldLeftPadding:(UITextField *)textField forWidth:(CGFloat)leftWidth
{
    CGRect frame = textField.frame;
    frame.size.width = leftWidth;
    UIView *leftview = [[UIView alloc] initWithFrame:frame];
    textField.leftViewMode = UITextFieldViewModeAlways;
    textField.leftView = leftview;
}

//登录按钮点击事件
- (void)loginClickAction:(id)sender {
    
    //    self.bt = [BBGToast makeText:@"登录成功"];
    //    [self.bt showWithType:ShortTime];
    //    [self goToMain];
}



@end
